package com.enze.encryptionanddecryption.JiaMi;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

/**
 * @Author TacoMan
 * @Date 2023/6/12 10:36
 * @Version 1.0
 */
public class Base64Demo {
    public static void main(String[] args) {
        String str="D:/桌面/img/0fa.jpg";
        String encode = Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8));
        System.out.println(encode);
        // JDK1.8 Base64解密
        byte[] bytes = Base64.getDecoder().decode(encode);
        String res = new String(bytes);
        System.out.println(res);
    }
}
